package com.googlecode.chigs.web;

import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;

import com.googlecode.chigs.web.common.IconFactory;

public class SubmitCancelPanel extends Panel {
	public SubmitCancelPanel(String id) {
		super(id);
		
		add(new Image("submit", IconFactory.createOkIconReference()));
		
		Link<Void> cancelLink = new Link<Void>("cancelButton") {
			@Override
			public void onClick() {
				doCancel();
			}
		};
		cancelLink.add(new Image("icon", IconFactory.createCancelIconReference()));
		add(cancelLink);
	}
	
	protected void doCancel() {
		setResponsePage(getApplication().getHomePage());
	}
}